package com.qf.springbootshiro;

import java.util.*;

public class test {
    public static void main(String[] args) {
        Integer[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        Integer target = 7;
        Map<Integer, List<Integer[]>> map = new HashMap<>();
        for (int i = 0, j = i + 1; i < arr.length - 1; ) {
            Integer[] brr = {i, j};
            int value = arr[i] + arr[j];
            if (map.containsKey(value)) {
                List<Integer[]> list = map.get(value);
                list.add(brr);
                map.put(value, list);
            } else {
                List<Integer[]> list = new ArrayList<>();
                list.add(brr);
                map.put(value, list);
            }
            if (++j >= arr.length) {
                j = ++i + 1;
            }
        }
        for (Integer[] integers : map.get(target)) {
            System.out.println(Arrays.toString(integers));
        }
    }
}
